package core

import (
	"prometheus_import_consul/global"

	"github.com/hashicorp/consul/api"
)

// consul 初始化
func ConsulConnect() (*api.Client, error) {
	config := api.DefaultConfig()
	config.Address = global.Config.Consul.URL()
	if client, err := api.NewClient(config); err != nil {
		return nil, err
	} else {
		return client, nil
	}
}
